﻿#region Using

using SAPbouiCOM;
using SapFramework.Interface.Controls.Items.Base;

using Form = SapFramework.Interface.Controls.Forms.Base.Form;
using Item = SapFramework.Interface.Controls.Items.Base.Item;

#endregion

namespace SapFramework.Interface.Controls.Items.Specific
{
    /// <summary>
    /// Realiza o encapsulamento de um objeto do tipo <see cref="SAPbouiCOM.ActiveX"/> da UI API do SAP Business One
    /// </summary>
    /// <remarks>
    /// A UI API não suporta objetos ActiveX escritos em Visual Basic 6.0.
    /// </remarks>
    public sealed class ActiveX : Item, SAPbouiCOM.ActiveX
    {
        /// <summary>
        /// Guarda uma referencia para a parte específica do item
        /// </summary>
        private readonly SAPbouiCOM.ActiveX mActiveX;

        /// <summary>
        /// Construtor
        /// </summary>
        /// <param name="aForm">O formulário ao qual o item pertence</param>
        /// <param name="aItemUniqueId">Id único do Item do Form do SAP Business One</param>
        public ActiveX( Form aForm, string aItemUniqueId ) : base( aForm, aItemUniqueId, BoFormItemTypes.it_ACTIVE_X )
        {
            mActiveX = mItem.Specific as SAPbouiCOM.ActiveX;
        }

        #region Implementation of IActiveX

        /// <summary>
        /// A interface para o objeto ActiveX.
        /// </summary>
        public object Object
        {
            get { return mActiveX.Object; }
        }

        /// <summary>
        /// O caminho para o ProgID ou GUID do objeto ActiveX.
        /// </summary>
        public string ClassID
        {
            get { return mActiveX.ClassID; }
            set { mActiveX.ClassID = value; }
        }

        #endregion
    }
}